package com.lfy.yunpicture.manager.websocket.model;

/**
 * 图片编辑类型枚举
 */

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import lombok.Getter;

/**
 * 图片编辑类型枚举
 */
@Getter
public enum PictureEditTypeEnum {
    INFO("信息", "INFO"),
    ERROR("错误", "ERROR"),
    ENTER_EDIT("进入编辑", "ENTER_EDIT"),
    EXIT_EDIT("退出编辑", "EXIT_EDIT"),
    ACTION_EDIT("编辑操作", "ACTION_EDIT");

    private final String text;
    private final String value;

    PictureEditTypeEnum(String text, String value) {
        this.text = text;
        this.value = value;
    }

    public static List<String> getValues() {
        return Arrays.stream(values()).map(PictureEditTypeEnum::getValue).collect(Collectors.toList());
    }

    public static PictureEditTypeEnum getEnumByValue(String value) {
        if (value == null) {
            return null;
        }
        for (PictureEditTypeEnum valueEnum : values()) {
            if (valueEnum.getValue().equals(value)) {
                return valueEnum;
            }
        }
        return null;
    }
}
